import request from '@/utils/request'

export function getScripts(data) {
    return request({
        url: '/scripts',
        method: 'get',
        params: data
    })
}

export function createScripts(data) {
    return request({
        url: '/scripts',
        method: 'post',
        data
    })
}

export function getScript({id, ...data}) {
    return request({
        url: `/scripts/${id}`,
        method: 'get',
        params: data
    })
}

export function removeScript({id, ...data}) {
    return request({
        url: `/scripts/${id}`,
        method: 'delete',
        params: data
    })
}

export function updateScript({id, ...data}) {
    return request({
        url: `/scripts/${id}`,
        method: 'put',
        data
    })
}

export function runScript({id, ...data}) {
    return request({
        url: `/scripts/${id}/run`,
        method: 'post',
        data
    })
}

export function checkScript(data) {
    return request({
        url: "/scripts/checkScript",
        method: 'get',
        params: data
    })
}